<?php
	
	include('cms.php');
	
	Cms::nocache();
	
	if(isset($_GET['comment']) && isset($_GET['idcontent'])){
		Log::add(COMMENT, $_GET['idcontent'], $_GET['comment']);
	}
	
	if(isset($_GET['idcontent'])){
		
		$arr = DataLatte::arrayof('Log', 
			"
			SELECT cmsLog.*, cmsUser.nick cmsUser_iduser 
			FROM cmsLog 
			 INNER JOIN cmsUser ON cmsUser.iduser = cmsLog.cmsUser_iduser 
			WHERE cmsContent_idcontent = '" . $_GET['idcontent'] . "'
			ORDER BY date DESC
			");
		
		echo json_encode( $arr );
	}
	
?>